﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

using Qiang.Controls;
using Qiang.Data;

namespace GisMap
{
    public class MapFunctionAddNode : MapFunction
    {
        public MapFunctionAddNode()
            : base()
        {
            Cursor = System.Windows.Forms.Cursors.Cross;
        }

        #region 属性

        private IMapVectorLayer _shpLayer;

        public IMapVectorLayer ShpLayer
        {
            get { return _shpLayer; }
            set { _shpLayer = value; }
        }

        #endregion


        #region 方法

        public override void Active()
        {
            if (_shpLayer == null || _shpLayer.Dataset == null) return;
            base.Active();
        }

        public override void Deactive()
        {
            base.Deactive();
        }

        protected override void OnPaint(MapPaintArgs args)
        {
            base.OnPaint(args);
        }
        

        protected override void OnMouseDown(MapMouseArgs e)
        {
            base.OnMouseDown(e);
        }

        protected override void OnMouseUp(MapMouseArgs e)
        {
            INodeShape node = new NodeShape(e.GeoLocation);
            _shpLayer.Dataset.AddShape(node);
            base.OnMouseUp(e);
        }

        #endregion


    }
}
